home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 3
/
Cream of the Crop 3.iso
/
clipper
/
ks94an.zip
/
DBCHOICE.HDR
< prev
next >
Wrap
Text File
|
1994-04-25
|
6KB
|
146 lines
/******************************************************************************
The Klipper Library, for CA-Clipper 5.x
Copyright (c), 1994, Wallace Information Systems Engineering
FUNCTION:
_DBChoice(cDBName, cDBIndex, cDBFdExp, cRetExpr, nTRow, nTCol, nBRow, nBCol,
cColor, lBorder ) --> xExpression
PARAMETERS:
cDBName = Name of Database File/Alias to Find/Open
cDBIndex = Index[es] to Open with File
cDBFldExp = Field Expression to display
cRetExpr = Character expression evaluated as return value
nTRow = Window Coordinates including border
nTCol = (i.e., actual data window is one row/col
nBRow = inside these coordinates)
nBCol = " "
cColor = Color to Use for Window
lBorder = logical, TRUE = Draw Border, False = NO BORDER (DEFAULT)
nBoxType = Border type
SHORT:
Windowed database field picklist with return value from specified fields.
DESCRIPTION:
cDBName is either an explicit file name, or an alias of a currently
open database file. If not specified (NIL) then the current work area
is assumed. If no current work area, the function returns "" (empty()).
All open work areas are scanned to see if the file is currently open under
the alias specified in cDBName. If the file is open already, either in
the current or some other open work area with the ALIAS specified in
cDBName, _DBChoice() switches to that area and proceeds. If the alias is
not found, then cDBName is used as an explicit file name to open. In
either case, if the file is being used in, or attempting to use a file
in, EXCLUSIVE mode, and that file cannot be accessed, then _DBChoice()
returns NIL to indicate such.
If the database file is NOT open in any work area, it is opened in an
unused work area, browsed, and closed upon exit at which time, the
original work area (if any) is restored. Thus, _DBChoice() will not
change the status of your work areas or open files. When it returns, all
will be as it was before you made the function call.
If the specified database IS open, then cDBName must be the ALIAS that
the database is open under.
If the specified database is NOT open, then the filename specified must
either the filename only with the '.dbf' assumed. The key is that if the
file specified in cDBName is open then cDBName is going to be used in a
SELECT statement and must select by ALIAS. If the file is not open then
the file is going to be opened with the name specified in cDBName. Thus,
if TEST.DBF is open and cDBName = 'TEST.DBF', then the select statement
is going to attempt: SELECT TEST.DBF which will produce a runtime
error because the ALIAS is TEST not TEST.DBF.
It is safe, when using .DBF files to simply specify the FILENAME only.
Thus the alias will select via a simple "SELECT cDBName", and if it is
not open, the the "USE cDBName" will work satisfactorily.
Thus "SELECT TEST" and "USE TEST" will both work.
cDBIndex is an explicit index file name. When _DBChoice() looks for
the database file in the open work areas, if a file is found in any of
those work areas and _DBChoice() switches to that area, then the
indexes currently open in that area are used and cDBIndex is ignored.
cDBIndex is only used when the requested database file is not open
and _DBChoice() itself opens it and opens the index or indexes named
in cDBIndex with it. This is a character expression and may contain
multiple indexes separated by a comma in the usual way.
cDBFldExp is a character expression containing a field name expression to
be used to display the target database.
NOTE:
The combined length of the fields specified in cDBFldExp (not the length
of the expression field itself) cannot exceed the window coordinates passed.
cRetExpr is a character expression that is evaluated and applied at the
time that _DBChoice() exits the function. This evaluation is made BEFORE
the work area is closed or exited so that the expression may reference
any fields in the record selected. If cRetExpr is not specified,
_then _DBChoice() returns the selected record's record number.
The function will automatically fill the window such that the last
physical record will reside on the last line of the window so that there
will be no blank records displayed. Likewise, when paging up through
the window, if there are not enough records to fill the window, the
first physical record will reside in the first line of the window, again
to prevent display of blank lines in the DBChoice() window. This is
not possible however, if the number of records in the database is less
than the number of lines in the display window. In such a case, blank
lines are inevitable. For that reason, if a blank record is
selected, _DBChoice() returns NIL to indicate such.
nTRow, nTCol, nBRow, nBCol are window coordinates. By default, the
actual working space will be one row and one character INSIDE
these coordinates as a border is drawn AT these coordinates. If
these parameters are not specified, or are invalid (i.e., TOP row is
greater than Bottom Row), default values are used. The optional
lBorder parameter modifies this (see below).
The default window is 00,00 to MaxRow(),MaxCol()
cColor is a character expression containing the color string to be used
for the _DBChoice() window. If you do not specifiy this parameter,
the current colors are used as default.
lNo_Border is a logical. If TRUE, then no border is drawn and the
window coordinates are used for the actual data area. If FALSE, then the
data area is one ROW/COL INSIDE the window coordinates and the window
border is drawn AT the window coordinates. Also, if .f., Column Headers
are draw as described.
nBoxType is the type of border you wish to use. _DBChoice() calls
_PopBox() to accomplish this. You may refer to _PopBox() for information
on Box Types.
_DBChoice() presents a database for browse only, and evaluates an
expression for a return value when ENTER is pressed. If ESC is pressed,
the expression is not evaluated and the function returns NIL.
RETURNS: If no Expression is specified, a record number is returned. If
an expression is specified and is valid, the results of that evaluation
are returned only when ENTER is pressed. ESC returns NIL.
EXAMPLE:
******************************************************************************/